'use strict';

const Service = require('egg').Service;

class AuthService extends Service {
  async authenticate(username, password) {
    // 模拟政采云AD认证
    if (username === 'admin' && password === 'Zcy@2023') {
      return {
        id: 1,
        name: '管理员',
        province: 'ZHEJIANG',
        role: 'ADMIN'
      };
    }
    this.ctx.throw(401, '用户名或密码错误');
  }
}

module.exports = AuthService;